package com.sx.pipeline.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.sx.pipeline.R
import com.sx.pipeline.repos.http.res.ViewInquiryVo
import com.sx.pipeline.utils.AndroidUtil

/**
 * @Author：YY
 * @Date：2022/2/10
 * @Describe: 查看询价适配器
 */
class ViewInquiryAdapter(
) : BaseQuickAdapter<ViewInquiryVo, BaseViewHolder>(
    R.layout.item_view_inquiry
) {
    override fun convert(holder: BaseViewHolder, item: ViewInquiryVo) {
        holder.setText(R.id.tv_title, "询价" + (holder.position + 1))
        holder.setText(R.id.tv_num,"需要数量："+item.quantity+item.unit)
        holder.setText(R.id.tv_time,"供货时间："+item.startTime+"-"+item.endTime)
        val view = holder.getView<TextView>(R.id.tv_name)
        view.text="联系人："+item.contact+"  联系方式："+AndroidUtil.phoneHide(item.contactPhone)
        holder.getView<TextView>(R.id.tv_call).setOnClickListener {
            //拨打电话
            AndroidUtil.toCallPhone(item.contactPhone,context)
        }

    }
}